home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 1
/
Precision Software Applications Silver Collection Volume One (PSM) (1993).iso
/
windows
/
games
/
tif2win.exe
/
TIF2BIT.DOC
< prev
next >
Wrap
Text File
|
1990-02-14
|
15KB
|
352 lines
TIF2BIT V2.2 TIFF -to- Lotus .BIT/RLE File Translator
Copyright 1988-90 William J. Hinkle
14 Feb 1990
=== User's Guide ===
The TIF2BIT program was created to allow graphics files created as TIFF
(Tagged Image Format Files) to be used in Lotus Manuscript documents. To do
this, the program translates the TIFF file into either a BIT or RLE bit-mapped
raster graphics file. Manuscript considers these file types interchangeable;
often RLE files are smaller but take longer to translate with TIF2BIT and
longer to load with Manuscript. This utility was created because Lotus
Manuscript R1 did not support TIFF files. Manuscript R2 still does not
support grayscale TIFF files, which TIF2BIT does. By creating BIT or RLE
files, Manuscript (and any other program that handles these files) thinks the
file was created by a scanner and is perfectly happy to integrate the picture.
The BIT2WP program is included to allow you to make the resultant BIT files
(or any other BIT file) into other bitmapped file formats, including TIFF.
This can be useful for other DeskTop Publishing applications, where TIF2BIT
is used to dither a grayscale TIFF, and BIT2WP is used to make it back into
a new, monochrome, TIFF (or other format). Output formats available are:
WPG (Word Perfect 5), TIFF (Intel flavor), BIT/RLE (Lotus Manuscript),
IMG (GEM), GIF (CompuServe), PCX (ZSoft/PC Paintbrush).
The two programs are: TIF2BIT.EXE, BIT2WP.EXE.
THE CATCH
=========
Note that these programs are released by the author, and are NOT supported
by any other. They are NOT public domain!
In fact, if you use these utilities extensively, the author will be glad to
accept your registration fee of $10.00 to offset costs of developing this
program. If you use TIF2BIT or BIT2WP in a commercial or business
environment, please consider this imperative.
Please see the very end of this document for details!
If you have received these utilities as part of the MetaScan bitmap-to-vector
conversion package, your TIF2BIT registration fee is included in the MetaScan
purchase.
RESTRICTIONS
============
Sorry! TIF2BIT V2.2 can handle only a subset of TIFF files!
TIFF monochrome grayscale and line-type images only -- but these are
the most common by far. In fact, I've never SEEN a TIFF files with the
characteristics noted below. If you've got one, send it to me!
Not yet handled are TIFF files with these characteristics:
RGB color files or Palette color files
--------------------------------------
An error occurs if TIF2BIT finds a TIFF color file.
Files using CCITT FAX or LZW Compression Schemes
------------------------------------------------
A error occurs if such a file is encountered.
Files with Orientation other than 1st row=top, 1st column=left
--------------------------------------------------------------
An informative warning will be issued, and the image will be out of
kilter (but otherwise correct).
OPERATION
=========
First create a TIFF file that contains the graphics image you want
to integrate into your document. You can create these directly from many
scanner and paint programs. Use the standard .TIF file extension (i.e.,
fname.TIF).
To create a .BIT file, type in:
TIF2BIT fname
or
TIF2BIT fname.TIF
or
TIF2BIT fname.TIF fname.BIT
from the DOS command prompt. The .TIF extension is assumed if you do not
specify one. The .BIT extension is assumed if you don't specify one.
The .BIT file name is made the same as the .TIF if not otherwise specified.
Full DOS pathnames can be specified.
The .TIF file will be translated to a .BIT file.
The .TIF file will not be erased. You can also specify scaling factors, but
the defaults often work the best (see below).
To create an .RLE file, type in:
TIF2BIT fname /r
or
TIF2BIT fname.TIF /r
or
TIF2BIT fname.TIF fname.RLE
from the DOS command prompt. The .TIF extension is assumed if you do not
specify and extension. You can specify the .RLE extension; otherwise the
.RLE extension is assumed when the /r option is used. The .RLE file name
is made the same as the .TIF if not otherwise specified. Full DOS pathnames
can be specified.
The .TIF file will be translated to an .RLE file.
The .TIF file will not be erased. You can also specify scaling factors, but
the defaults often work the best (see below).
You can specify a directory, ending with \, or a drive, ending in :, as the
second filename. The output file (BIT or RLE) will be put on that path with
the input filename and the appropriate extension.
COMPLEAT USAGE
==============
If you invoke TIF2BIT from DOS without any other parameters, it will
display the following help message. This shows some of the other command
line options.
-----
TIF-to-BIT Translator: V2.2 ... Copyright 1988-90 by W.J.Hinkle
Usage: TIF2BIT fname1 [fname2] [option] [option]
where: fname1.TIF ... TIFF format input file
fname2.BIT ... Bitmapped BIT output file (default is fname1.BIT)
or fname2.RLE ... Bitmapped RLE output file (default is fname1.RLE)
Command Line Options:
/v ... reverse video
/iN ... select sub-image N (default is 1)
/cN ... change contrast by N%
/p ... print pixel histogram data
/eN ... error diffused dither, expanding xN (default is 1)
/dN ... force dither block to NxN (<=0 =error diffused)
/hN ... force halftone block to NxN
/xN ... x density = N pixels-per-inch
/yN ... y density = N lines-per-inch
/fr ... format RLE file output
TIF2BIT is a translator from Microsoft/Aldus TIFF files
to bitmapped BIT files (default) or RLE files (using /fr).
These are Lotus Manuscript image file formats.
Grayscale files are dither with error diffusion, by default.
You can choose pattern halftone with /hN, N=1,2,3 or 4, or
patterned dither with /dN, N=1,2,4 or 8. Use /p to get a pixel histogram.
The X and Y density is taken from the TIFF file and adjusted for the
halftone block size (if used) unless set by /xN or /yN.
This version handles only monochrome & grayscale TIFF files.
(followed by my shareware info...)
-----
If your TIFF file contains multiple sub-iamges, you can specify which one
to extract and translate by specifying the /iN option, where N is the sub-
image number 1,2,3... etc. Normally, you can ignore this option; the 1st
(or only!) image will be translated. If there are additional sub-images
beyond the one selected, a warning is issued and they are ignored.
Normally TIF2BIT tells Manuscript that the image density is whatever the
TIFF file indicates, or 200x200 pixels (or lines) per inch if not specified.
This lets Manuscript compute the "natural" size of the graphics image.
You can specify a different density by specifying it with either the /x or /y
option switches (e.g. /x300 is 300 pixels per inch wide). You can also
alter the aspect ratio by specifying both the /x and /y option switches, with
different density values. The overrides are NOT further adjusted for
halftoning!
Of course, you can always scale the image in the Manuscript \picture\ command
or picture marker.
Normally TIF2BIT retains the Photometric Interpretation indicated in the
TIFF file. Often what looks good on the screen looks lousy on white paper.
If you want a reverse video effect, use the /v option switch.
Grayscale TIFF files can be either dither with error diffusion (the default)
or pattern dithered, or pattern halftoned. This is necessary because each
point in the output image is either black or white -- not gray. Each of
these methods "smears" the picture a bit in order to fool the eye into
"seeing" gray tones in the image.
Error diffusion dithering (the default) spreads the black and white pixels
around in order to minimize the error in brightness at each point in the
image. In order to improve the results, the number of pixels in the image
is doubled in each direction before dithering. You can change this increase
in size by specifying the multiplier in the /eN option.
For example, the default case is /e2. You can triple the image size before
dithering by specifying /e3. You can use the original image size by
specifying /e1. Usually the results get better as you increase this dither
size factor. Sadly, the file size of the output file gets much bigger!
Pattern dither uses a fixed grid to determine which pixels will be black and
which will be white in order to simulate gray tones. This keeps the file
size down but usually results in very grainy images. The size of the dither
grid, or block, is specified by /dN, where N is 1, 2, 4 or 8, and an NxN
grid is used.
Halftoning maps each gray pixel into a grid of black/white pixels with a
corresponding optical density. You specify this grid, or block, with the
/hN option. N is 1, 2, 3 or 4; an NxN grid is used. Note that sometimes
halftoning with a smaller grid than 4x4 will provide a better image.
You can also expand a black-and-white TIFF image by 2, 3 or 4 times in each
dimension, using the /hN option. The /dN and /eN options WILL NOT do this!
Experiment!
If halftoning is used, the BIT file image density is adjusted for the size of
the halftone matrix. In other words, Manuscript always sees the "natural"
size of the original image, even after halftoning.
If a gray response curve is included in the TIFF file, it will be used during
halftoning or dithering to properly adjust the optical density of the image.
The contrast will be set to use the total gray response of the image. In some
cases you may have to adjust it back down with the /cN option.
The /cN option can be specified to crudely adjust the contrast of the image
before halftoning or dithering. The effect is to multiply each raw pixel
value by N% (after adjustment by the grayscale response curve, if any). The
factor N can be greater or less than 100. If not specified, a contrast is
selected to spread the range of image pixel values over the entire range of
halftone or dither values.
The /p option causes a histogram to be kept on the distribution of raw pixel
values in a grayscale TIFF file (before contrast and grayscale response curve
adjustments). The number of occurences of each pixel value are printed on
the screen when the translation is complete.
EXAMPLES
========
1) Suppose you have a line-art TIFF file called "yikes.tif". You can translate
this to a BIT file by typing (at the DOS prompt):
TIF2BIT yikes
and you will see something like:
-----
TIF-to-BIT Translator: V2.2 ... Copyright 1988-90 by W.J.Hinkle
From TIFF 640x250x1 file: yikes.tif
to BIT/RLE 640x250 file: yikes.bit
"Natural" picture size is 9.014W x 6.410H inches.
-----
Note that both the TIFF file resolution (and grayscale depth, here 1 bit),
and the BIT file resolution, are shown. Also shown are the "natural" size
of the final image, and the file names.
2) Suppose you have a grayscale TIFF file called "pebble75.tif". You can
translate this to a BIT file by typing (at the DOS prompt):
TIF2BIT pebble75
and you will see something like:
-----
TIF-to-BIT Translator: V2.2 ... Copyright 1988-90 by W.J.Hinkle
From TIFF 156x131x4 file: pebble75.tif
to BIT/RLE 312x232 file: pebble75.bit
halftoned error diffused with 125% contrast.
"Natural" picture size is 2.080W x 1.746H inches.
-----
Here the TIFF file grayscale depth is 4 bits. Note that the BIT file
resolution is multiplied by two in each dimension. Note also that the
contrast was automatically increased, as indicated by the TIFF file's gray
response curve.
CAVEAT
======
Should you have any difficulties using this program, I'll try to help.
You can try leaving Compuserve EMAIL to Bill Hinkle at [71121,3211]. General
feedback is welcome, especially on better methods of grayscale halftoning
and dithering.
Thanks to Jeff Lewis [72717,1033] for ideas on halftoning and dithering.
REVISION INFO
=============
* Version number Date Explanation *
* -------------- ------ -------------------------- *
* 1.0 15 Mar 88 original release *
* 1.1 18 Mar 88 Added 32768 (short strip offsets) tag *
* and fixed 32773 (PackBits) compression *
* and fixed YResolution default problem *
* and SamplesPerPixel tag problem *
* and added pseudo-grayscale handling *
* 1.2 19 Mar 88 Added grayscale handling *
* 1.3 15 Apr 88 Added both dithering & halftoning, *
* modified the halftone matrix, *
* removed margin, added contrast *
* adjustment, added pixel histogram *
* 1.4 20 Apr 88 Added support for Motorola TIFF files *
* 1.5 21 Apr 88 Added support for type 2 compression, *
* sub-image extraction. *
* 1.6 27 Apr 88 Cleaned up incorrect help messages, *
* added output file directory support *
* 1.7 05 May 88 Change intensity level selection and *
* altered dither & halftone levels *
* 1.8 07 Jun 88 Speeded up dithering & halftoning *
* 2.0 08 Dec 88 Added error-diffused dithering *
* and .RLE extension recognition *
* and some tweeks for TIFF V5 *
* 2.1 02 Dec 89 Fixed obscure problem with Mac format *
* TIFFs (some grayscales and stripped) *
* 2.2 09 Feb 90 Changed help message, added /eN error *
* diffusion flag instead of /d-N. Allow *
* multiplication of size for 1-bit TIFFs *
* using the /hn parameter. *
COPYRIGHT INFO
==============
These programs TIF2BIT.EXE, BIT2WP.EXE were written by
William J. Hinkle
who retains the copyright. Copy and use them freely. Distribute them
to whomever you want. But:
=== Do not distribute modified versions.
=== Do not remove the copyright notice.
=== Always distribute these programs together, and with the documentation.
If you feel that these programs have been of some utility, please register
by sending your registration fee of $10.00. If you are using these programs
in a commercial environment, please consider this mandatory. You will
receive a written receipt. Thank you!
William J. Hinkle [71121,3211]
420 E.Boston Mills Rd.
Hudson, OH 44236-1111